package com.hutao.manage.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.hutao.manage.datasource.TargetDataSource;
import com.hutao.manage.mapper.MrPageTypeMapper;
import com.hutao.manage.pojo.MrPageType;
import com.hutao.manage.service.MrPageTypeService;

@Service
public class MrPageTypeServiceImpl implements MrPageTypeService {

	@Autowired
	private MrPageTypeMapper mrPageTypeMapper;
	
	@TargetDataSource(name="ds1")
	@Transactional(readOnly=true)
	@Override
	public List<MrPageType> getMrPageTypes() {
		// TODO Auto-generated method stub
		return mrPageTypeMapper.getMrPageTypes();
	}

	@TargetDataSource(name="ds1")
	@Transactional(readOnly=true)
	@Override
	public List<Map<String, Object>> getMrPageTypesOfPaginationCountByFirstGuid(
			String firstGuid) {
		// TODO Auto-generated method stub
		return mrPageTypeMapper.getMrPageTypesOfPaginationCountByFirstGuid(firstGuid);
	}

	@TargetDataSource(name="ds1")
	@Transactional(readOnly=true)
	@Override
	public List<Map<String, Object>> getMrPageTypesOfPaginationCountByFirstGuidAndMrPageTypes(
			String firstGuid, List<Integer> mrPageTypes) {
		// TODO Auto-generated method stub
		/*StringBuilder sbMrPageType = new StringBuilder();
		for (int i = 0; i < mrPageTypes.size(); i++) {
			sbMrPageType.append(mrPageTypes.get(i));
			if(i<mrPageTypes.size()-1){
				sbMrPageType.append(",");
			}
		}*/
		return mrPageTypeMapper.getMrPageTypesOfPaginationCountByFirstGuidAndMrPageId(firstGuid, mrPageTypes);
		
	}

}
